<template>
  <div class='wrap'>
    <swiper :options="swiperOptions" class='banner' v-if='showBanner'>
      <swiper-slide v-for="item in swiperList" :key='item.id' >
        <img :src="item.imgUrl" :key='item.id' alt="">
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination">1</div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: 'homeSwiper',
  props: {
    swiperList: Array
  },
  data () {
    return {
      swiperOptions: {
        pagination: '.swiper-pagination',
        autoplay: 2000,
        loop: true
      }
    }
  },
  computed: {
    showBanner () {
      return this.swiperList.length
    }
  }
}
</script>
<style lang="stylus" scoped>
  .wrap
    width: 100%;
    // border-bottom: 50%;
  .banner img {
    width: 100%;
    height: 100%;
  }
  >>> .swiper-pagination-bullet-active
    background-color: #ccc;
</style>
